package com.example.exchange;

import org.apache.log4j.Logger;

import com.example.exchange.UnifierWebServicesUfbs;


public class UnifierWebServicesUfbs {
	static Logger logger = Logger.getLogger(UnifierWebServicesUfbs.class);
	
	public String shortname, authcode, _endpoint;
	private UnifierWebServicesPortType unifierWebServicesPortType = null;
	private GetPUConnection conn =null;

	public UnifierWebServicesUfbs() {
		conn = new GetPUConnection();
		this.shortname = conn.getShortname();
		this.authcode = conn.getAuthcode();
		this._endpoint = conn.getEndpoint();
		
//		logger.info("conn.getEndpoint();: "+conn.getEndpoint());
		_initUnifierWebServicesPortTypeProxy();
	}

	public UnifierWebServicesUfbs(String endpoint) {
		_endpoint = endpoint;
		_initUnifierWebServicesPortTypeProxy();
	}


	private void _initUnifierWebServicesPortTypeProxy() {
		try {
			unifierWebServicesPortType = (new UnifierWebServicesLocator()).getUnifierWebServicesHttpSoap11Endpoint();
			if (unifierWebServicesPortType != null) {
				if (_endpoint != null) {
					((javax.xml.rpc.Stub) unifierWebServicesPortType)
					._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
				}
			}
		} catch (javax.xml.rpc.ServiceException serviceException) {
			serviceException.printStackTrace();
		}
	}

	public void setEndpoint(String endpoint) {
		_endpoint = endpoint;
		if (unifierWebServicesPortType != null)
			((javax.xml.rpc.Stub) unifierWebServicesPortType)._setProperty("javax.xml.rpc.service.endpoint.address",
					_endpoint);

	}

	public UnifierWebServicesPortType getUnifierWebServicesPortType() {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType;
	}

	public XMLObject createUpdateResource(String resourceXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createUpdateResource(shortname, authcode, resourceXML);
	}

	public XMLObject getProjectShellList(String options)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getProjectShellList(shortname, authcode, options);
	}

	public XMLObject getScheduleSheetDataMaps(String projectnumber, String sheetName,
			String options) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getScheduleSheetDataMaps(shortname, authcode, projectnumber, sheetName,
				options);
	}

	public XMLObject getScheduleSheetList(String projectnumber, String options)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getScheduleSheetList(shortname, authcode, projectnumber, options);
	}

	public XMLObject updateUserGroupMembership(String membershipXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateUserGroupMembership(shortname, authcode, membershipXML);
	}

	public XMLObject updateUserShellMembership(String projectNumber,
			String membershipXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateUserShellMembership(shortname, authcode, projectNumber, membershipXML);
	}

	public XMLObject updateScheduleActivitiesFromFileV2(String projectNumber,
			String sheetName, String iszipfile, String options, FileData files) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateScheduleActivitiesFromFileV2(shortname, authcode, projectNumber,
				sheetName, iszipfile, options, files);
	}

	public XMLObject createScheduleActivitiesFromFileV2(String projectNumber,
			String sheetName, String iszipfile, String options, FileData files) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createScheduleActivitiesFromFileV2(shortname, authcode, projectNumber,
				sheetName, iszipfile, options, files);
	}

	public XMLObject updateBPRecordV2(String projectNumber, String BPName,
			String BPXML, String options) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateBPRecordV2(shortname, authcode, projectNumber, BPName, BPXML, options);
	}

	public XMLObject getTransactionStatus(String transXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getTransactionStatus(shortname, authcode, transXML);
	}

	public XMLObject getSOV(String projectNumber, String BPName, String recordNumber)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getSOV(shortname, authcode, projectNumber, BPName, recordNumber);
	}

	public XMLObject getRoleList(String filterOptions)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getRoleList(shortname, authcode, filterOptions);
	}

	public XMLObject getResourceList(String filterOptions)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getResourceList(shortname, authcode, filterOptions);
	}

	public XMLObject getPlanningItem(String projectNumber, String BPName,
			String recordNumber, String planningitem) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getPlanningItem(shortname, authcode, projectNumber, BPName, recordNumber,
				planningitem);
	}

	public XMLObject updateUser(String userXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateUser(shortname, authcode, userXML);
	}

	public XMLObject getUserList(String filterCondition)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getUserList(shortname, authcode, filterCondition);
	}

	public XMLObject createUser(String copyFromUserPreferenceTemplate,
			String userXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createUser(shortname, authcode, copyFromUserPreferenceTemplate, userXML);
	}

	public XMLObject createUpdateRole(String roleXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createUpdateRole(shortname, authcode, roleXML);
	}

	public XMLObject getSpaceList(String projectNumber, String spacetype,
			String fieldnames, String filterCondition) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getSpaceList(shortname, authcode, projectNumber, spacetype, fieldnames,
				filterCondition);
	}

	public XMLObject getLevelList(String projectNumber, String fieldnames,
			String filterCondition) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getLevelList(shortname, authcode, projectNumber, fieldnames, filterCondition);
	}

	public XMLObject updateSpace(String projectNumber, String spacetype,
			String spaceXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateSpace(shortname, authcode, projectNumber, spacetype, spaceXML);
	}

	public XMLObject createSpace(String projectNumber, String spacetype,
			String spaceXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createSpace(shortname, authcode, projectNumber, spacetype, spaceXML);
	}

	public XMLObject updateLevel(String projectNumber, String levelXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateLevel(shortname, authcode, projectNumber, levelXML);
	}

	public XMLObject createLevel(String projectNumber, String levelXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createLevel(shortname, authcode, projectNumber, levelXML);
	}

	public XMLObject updateShell(String shellType, String shellXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateShell(shortname, authcode, shellType, shellXML);
	}

	public XMLObject ping(String shortname, String username, String password, String version)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.ping(shortname, username, password, version);
	}

	public XMLObject updateBPRecord(String projectNumber, String BPName,
			String BPXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateBPRecord(shortname, authcode, projectNumber, BPName, BPXML);
	}

	public XMLObject createBPRecord(String projectNumber, String BPName,
			String BPXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createBPRecord(shortname, authcode, projectNumber, BPName, BPXML);
	}

	public XMLObject updateScheduleActivities(String projectNumber, String sheetName,
			String sheetXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateScheduleActivities(shortname, authcode, projectNumber, sheetName,
				sheetXML);
	}

	public XMLObject updateScheduleActivitiesV2(String projectNumber,
			String sheetName, String sheetXML, String options) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateScheduleActivitiesV2(shortname, authcode, projectNumber, sheetName,
				sheetXML, options);
	}

	public XMLObject createScheduleActivitiesV2(String projectNumber,
			String sheetName, String sheetXML, String options) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createScheduleActivitiesV2(shortname, authcode, projectNumber, sheetName,
				sheetXML, options);
	}

	public XMLObject updateColumnData(String projectNumber, String columnName,
			String columnXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateColumnData(shortname, authcode, projectNumber, columnName, columnXML);
	}

	public XMLObject addCompleteBPLineItem(String projectNumber, String BPName,
			String BPXML, String iszipfile, FileData[] files) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.addCompleteBPLineItem(shortname, authcode, projectNumber, BPName, BPXML,
				iszipfile, files);
	}

	public XMLObject getShellList(String shellType, String filterCondition)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getShellList(shortname, authcode, shellType, filterCondition);
	}

	public XMLObject createWBS(String projectNumber, String WBSXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createWBS(shortname, authcode, projectNumber, WBSXML);
	}

	public XMLObject updateWBS(String projectNumber, String WBSXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateWBS(shortname, authcode, projectNumber, WBSXML);
	}

	public XMLObject sortCostSheet(String projectNumber, String type,
			String sortOrder) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.sortCostSheet(shortname, authcode, projectNumber, type, sortOrder);
	}

	public XMLObject createProject(String cloneProjectNumber, String projectXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createProject(shortname, authcode, cloneProjectNumber, projectXML);
	}

	public XMLObject getColumnData(String projectNumber, String columnName)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getColumnData(shortname, authcode, projectNumber, columnName);
	}

	public XMLObject getBPList(String projectNumber, String BPName,
			String[] fieldnames, String filterCondition, String[] filtervalues) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();

		return unifierWebServicesPortType.getBPList(shortname, authcode, projectNumber, BPName, fieldnames,
				filterCondition, filtervalues);
	}

	public XMLObject createConfigurableModuleRecord(String projectNumber,
			String CMCode, String className, String copyFromRecord, String recordXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createConfigurableModuleRecord(shortname, authcode, projectNumber, CMCode,
				className, copyFromRecord, recordXML);
	}

	public XMLObject updateSapBPRecord(String projectNumber, String BPName,
			String BPXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateSapBPRecord(shortname, authcode, projectNumber, BPName, BPXML);
	}

	public XMLObject addBPLineItem(String projectNumber, String BPName, String BPXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.addBPLineItem(shortname, authcode, projectNumber, BPName, BPXML);
	}

	public XMLObject getWBSStructure(String shortname, String authcode) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getWBSStructure(shortname, authcode);
	}

	public XMLObject getWBSCodes(String projectnumber, String options)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getWBSCodes(shortname, authcode, projectnumber, options);
	}

	public XMLObject updateCompleteBPRecord(String projectNumber, String BPName,
			String BPXML, String iszipfile, FileData[] files) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateCompleteBPRecord(shortname, authcode, projectNumber, BPName, BPXML,
				iszipfile, files);
	}

	public XMLObject createShell(String copyFromShellTemplate, String shellXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createShell(shortname, authcode, copyFromShellTemplate, shellXML);
	}

	public XMLObject getSapBPList(String projectNumber, String BPName,
			String[] fieldnames, String filterCondition, String[] filtervalues) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getSapBPList(shortname, authcode, projectNumber, BPName, fieldnames,
				filterCondition, filtervalues);
	}

	public XMLObject getSapBPRecord(String projectNumber, String BPName,
			String recordNumber) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getSapBPRecord(shortname, authcode, projectNumber, BPName, recordNumber);
	}

	public XMLObject createAsset(String assetClassName, String copyFromAsset,
			String assetXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createAsset(shortname, authcode, assetClassName, copyFromAsset, assetXML);
	}

	public XMLObject createCompleteBPRecord(String projectNumber, String BPName,
			String BPXML, String iszipfile, FileData[] files) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createCompleteBPRecord(shortname, authcode, projectNumber, BPName, BPXML,
				iszipfile, files);
	}

	public XMLObject createSapBPRecord(String sapPoNo, String refBpName,
			String BPName, String BPXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createSapBPRecord(shortname, authcode, sapPoNo, refBpName, BPName, BPXML);
	}

	public XMLObject createScheduleActivities(String projectNumber, String sheetName,
			String sheetXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createScheduleActivities(shortname, authcode, projectNumber, sheetName,
				sheetXML);
	}

	public XMLObject getUDRData(String projectNumber, String reportName)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getUDRData(shortname, authcode, projectNumber, reportName);
	}

	public XMLObject getBPRecord(String projectNumber, String BPName,
			String recordNumber) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getBPRecord(shortname, authcode, projectNumber, BPName, recordNumber);
	}

	public XMLObject getScheduleActivities(String projectNumber, String sheetName)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getScheduleActivities(shortname, authcode, projectNumber, sheetName);
	}

	public XMLFileData getCompleteBPRecord(String projectNumber, String BPName,
			String recordNumber) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getCompleteBPRecord(shortname, authcode, projectNumber, BPName, recordNumber);
	}

	public XMLObject updateConfigurableModuleRecord(String projectNumber,
			String CMCode, String className, String recordXML) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateConfigurableModuleRecord(shortname, authcode, projectNumber, CMCode,
				className, recordXML);
	}

	public XMLObject createFundingStructure(String projectNumber, String WBSXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.createFundingStructure(shortname, authcode, projectNumber, WBSXML);
	}

	public XMLObject updateExchangeRates(String ratesXML)
			throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.updateExchangeRates(shortname, authcode, ratesXML);
	}

	public XMLObject getExchangeRates(String shortname, String authcode) throws java.rmi.RemoteException {
		if (unifierWebServicesPortType == null)
			_initUnifierWebServicesPortTypeProxy();
		return unifierWebServicesPortType.getExchangeRates(shortname, authcode);
	}
}
